import java.util.Scanner;

public class jiefangcheng {
    public static void math(double a, double b, double c){
        double D = b * b + 4 * a * c;
        if(a == 0)
            if(b == 0)
            {
                if(c == 0)
                    System.out.println("方程有无穷解");
                else
                    System.out.println("方程无解");
            }
        else
                System.out.println("方程的解 x = ：" + (-c / b));
        if(D > 0)
        {//两个不相等实数根
            System.out.println("方程有不相等的两个实数根");
            System.out.println("x1 = " + ((-b + Math.sqrt(D)) / (2 * a)));
            System.out.println("x2 = " + ((-b - Math.sqrt(D)) / (2 * a)));
        }
        else if(D == 0)
        {//两个相等实数根
            System.out.println("方程有两个相等实数根");
            System.out.println("x1 = x2 = " + (- b / (2 * a)));
        }
        else
        {//两个复数根
            System.out.println("方程有两个复数根");
            //实部
            double realpart = - b / (2 * a);
            //虚部
            double imaginarypart = Math.sqrt(-D) / (2 * a);
            System.out.println("x1 = " + realpart + " + " + imaginarypart);
            System.out.println("x2 = " + realpart + " - " + imaginarypart);
        }

    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入一元二次方程的系数 a,b,c");
        System.out.println("a = ");
        double a = scanner.nextDouble();
        System.out.println("b = ");
        double b = scanner.nextDouble();
        System.out.println("c = ");
        double c = scanner.nextDouble();
        jiefangcheng.math(a, b, c);
    }
}
